package com.atlin.project.model.vo.biProduces;

import com.atlin.project.model.domain.BiProducts;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * BI产品 VO
 */
@Data
public class BiProductsVO implements Serializable {
    /**
     * id
     */
    private Long id;

    /**
     * 商品名称
     */
    private String name;

    /**
     * 商品类别
     */
    private String category;

    /**
     * 商品价格
     */
    private BigDecimal price;

    /**
     * 商品描述
     */
    private String description;

    /**
     * 详情图片
     */
    private String detailImg;

    /**
     * 状态 0 - 正常 1 - 下架
     */
    private Integer status;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;


    /**
     * 包装类转对象
     *
     * @param biProductsVO
     * @return
     */
    public static BiProducts voToObj(BiProductsVO biProductsVO) {
        if (biProductsVO == null) {
            return null;
        }
        BiProducts biProducts = new BiProducts();
        BeanUtils.copyProperties(biProductsVO, biProducts);

        return biProducts;
    }


    /**
     * 对象转包装类
     *
     * @param biProducts
     * @return
     */
    public static BiProductsVO objToVo(BiProducts biProducts) {
        if (biProducts == null) {
            return null;
        }
        BiProductsVO biProductsVO = new BiProductsVO();
        BeanUtils.copyProperties(biProducts, biProductsVO);

        return biProductsVO;
    }

    private static final long serialVersionUID = 1L;
}